#pragma once

#include <utility>
#include <vector>

#include "planner/memo.h"
#include "planner/operator_visitor.h"
#include "planner/property_set.h"

namespace optimizer {

class ChildPropertyDeriver : public OperatorVisitor {
 public:
  std::vector<std::pair<PropertySet *, std::vector<PropertySet *>>> GetProperties(Memo *memo, PropertySet *requirements,
                                                                                  GroupExpression *gexpr);

  void Visit(PhysicalSeqScan *op) override;

  void Visit(OrderBy *op) override;

  void Visit(Limit *op) override;

 private:
  PropertySet *requirements_;

  std::vector<std::pair<PropertySet *, std::vector<PropertySet *>>> output_;

  Memo *memo_;

  GroupExpression *gexpr_;
};

}  // namespace optimizer
